<%@page pageEncoding="utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<table width='100%' height='31' border='0' cellspacing='0'
		cellpadding='0'>
	<tr>
		<td width='40'
			background='${pageContext.request.contextPath}/common/images/index_26.jpg'>&nbsp;
			
		</td>
		<!--内容区导航开始-->
		<td align='left' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>
			<span class="channel_title">图书管理
				<span style="color:#000;"> >> 新增图书信息  >></span> </span></td>
		<!--内容区导航结束-->
		<td align='left' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>&nbsp;
			
		</td>
		<td width='13' align='right' valign='middle'
			background='${pageContext.request.contextPath}/common/images/ctitle_bak_center.jpg'>
			<img src="${pageContext.request.contextPath}/common/images/ctitle_bak_right.jpg" height="31" width="10">
		</td>
	</tr>
</table>

<table width='100%' height="325px" border='0' cellspacing='0' cellpadding='0'>
	<tr>
		<td>
			<form name="form1" action="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=add" method="post" onsubmit="return (bookcheck());">
				<table align="center">
					<tr>
						<td><span style="fond-size:12px">一级类名：</span></td>
						<td><select id = "firstName" name="firstName" onchange="changetype()">
								<option value="">请选择一级图书类名</option>
								<c:forEach items="${bookTypes}" var="booktype">
									<option value="${booktype.id}">${booktype.typeName}</option>
								</c:forEach>
							</select>
						</td>
						<td><span style="fond-size:12px">    二级类名：</span></td>
						<td><div id="types">
							<select>
								<option>请选择二级图书类名</option>
							</select>	
							</div></td>
					</tr>
					<tr>
						<td><span style="fond-size:12px">编　号：</span></td>
						<td><input id="no" name="no" type="text"></td>
						<td><div id="checkno">
						</div></td>
					</tr>
					<tr>
						<td><span style="fond-size:12px">书　名：</span></td>
						<td><input name="name" id="name" type="text"></td>
						<td><span style="fond-size:12px">作　者：</span></td>
						<td><input name="author" id="author" type="text"></td>
						
					</tr>
					<tr>
						<td><span style="fond-size:12px">出版社：</span></td>
						<td><input name="publish" id="publish" type="text"></td>
						<td><span style="fond-size:12px">出版时间：</span></td>
						<td><input name="publishTime" id="publishTime"  type="text" onfocus="checkDate()"></td>
					</tr>
					<tr>
						<td><span style="fond-size:12px">价　格：</span></td>
						<td><input name="price" id="price" type="text"></td>
						<td><span style="fond-size:12px">数　量：</span></td>
						<td><input name="count" id="count" type="text"></td>
					</tr>
					<tr>
						<td><span style="fond-size:12px">备　注：</span></td>
						<td colspan="3"><textarea  name="remark" rows="5" cols="42"></textarea></td>
					</tr>
					<tr>
						<td height='31' colspan="2" align="center"><input name="submit" type="submit" value="< 添加图书 >"></td>
					 	<td colspan="2" align="center"><input type="reset" value="< 清空 >"></td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
</table>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/ajax.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/sysManage/js/book.js"></script>
	<script type="text/javascript">
	var client=null;
	function changetype(){
		var typeid = document.getElementById("firstName").value;
		client = createRequest();
		url="${pageContext.request.contextPath}/sysManage/bookManage/book.do?method=gettype&id="+typeid;
		 client.open("post",url,true);
		 client.onreadystatechange = handleResult;
		 client.send(null);
	}
	function handleResult(){
		if(client.readyState==4){
			var response = client.responseText;
			var div = document.getElementById("types");
			div.innerHTML=response;
		}
	}
	
	function checkDate(){
		alert("日期格式为：0000-00-00");
	}

</script>